<%= stylesheet_link_tag 'user' %>
<nav id="userMenu" class="subMenu">
	<a href="javascript:void(null)" id="addUser"><%= image_tag("layout/Create.png", :id => "createIcon", :alt => "Mitarbeiter anlegen", :class => "icon") %></a>
	<span class="subMenuPipe"></span>
	<a href="javascript:void(null)" id="selectUser"><%= image_tag("layout/System.png", :id => "chooseModeIcon", :alt => "In den Auswahlmodus wechseln", :class => "icon") %></a>
	<a href="javascript:void(null)" id="deleteUser"><%= image_tag("layout/Erase.png", :id => "chooseModeIcon", :alt => "Mitarbeiter l&ouml;schen", :class => "icon") %></a>
	<span class="subMenuPipe"></span>
	<a href="javascript:void(null)" id="showHideKey"><%= image_tag("layout/Information.png", :id => "keyIcon", :alt => "Die Legende ausblenden", :class => "icon") %></a>
	<span class="subMenuPipe"></span>
</nav>
<div id="wrapUserboard">
	<div id="userboard">
		<div id="keys">
			<nobr><span class="key scrummaster"></span> Scrummaster</nobr>
			<nobr><span class="key productowner"></span> Product Owner</nobr>
			<nobr><span class="key developer"></span> Developer</nobr>
		</div>
		<div id="userStoryList">
			<ul>
				<li><a href="javascript:void(null)" class="list_top_entry" id="dedicated_employees">Zugeordnete Mitarbeiter</a>
					<ul>
						<% @project.each do |proj| %>
							<li><a href="javascript:void(null)" class="projects" id="proj_<%= proj.id %>"><%= proj.name %></a>
								<ul id="project_<%= proj.id %>">		
									<% @ptu = ProjectToUser.joins(:project).where('project_id' => proj.id)  %>
									<% @ptu.each do |pt| %>
										<% 
										 @entries = User.joins(:project_to_users).where('id' => pt.user_id) 
										 us = @entries.first 
										 @loadobj = ProjectToUser.joins(:user).where('user_id' => us.id, "project_id" => proj.id)
										 rolename_id = @loadobj.first.rolename_id
										 load = @loadobj.first.percentage_id
										 @class=""
										 case rolename_id
											when 4 
												next
											when 3
												@class = "developer"
											when 2
												@class = "scrummaster"
											else 1
												@class = "productowner" 
											end
									 	%>
										<li class="mitarbeiter">
										<div class="<%= @class %>"></div>
										<a href="javascript:void(null)" class="employee_<%= us.id %>"><%= us.name %> (<%= load*10 %>%)</a>
										</li>							
									<% end %>		
								</ul>
							</li>
						<% end %>
					</ul>
				</li>
			</ul>
			
			<ul>
				<li><a href="javascript:void(null)" class="list_top_entry" id="undedicated_employees">Nicht ausgelastete Mitarbeiter</a>
					<ul id="underload_employees">
						<% @underloadHash.each_key do |key| %>
							<% us = User.where("id" => key).first %>
							<li class="mitarbeiter">
							<a href="javascript:void(null)" class="employee_<%= key %>"><%= us.name %> (<%= @underloadHash[key] %>%)</a>
							</li>
						<% end %>
					</ul>
				</li>
			</ul>	
			
			<ul>
				<li><a href="javascript:void(null)" class="list_top_entry" id="undedicated_employees">Überlastete Mitarbeiter</a>
					<ul id="overload_employees">
						<% @overloadHash.each_key do |key| %>
							<% us = User.where("id" => key).first %>
							<li class="mitarbeiter">
							<a href="javascript:void(null)" class="employee_<%= key %>"><%= us.name %> (<%= @overloadHash[key] %>%)</a>
							</li>
						<% end %>
					</ul>
				</li>
			</ul>
		</div>		
	</div>	
</div>
<div id="wrapUserDetail">
	<div id="singleuser"><!--#--></div>
</div>